
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Side.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Side)
{
	TEST(size should be 80 if input size is 80 in constructure)
	{
		Side side(80, 0, 100, true);
		ASSERT_EQ(80, side.getSize());
	}

        TEST(size should be 80.5 if input size is 80.5 in constructure)
        {
                Side side(80.5, 0, 100, true);
		ASSERT_EQ(0, side.getSize()-80.5);
        }

        TEST(size should be 80.01 if input size is 80.01 in constructure)
        {
                Side side(80.01, 0, 100, true);
		ASSERT_EQ(0, side.getSize()-80.01);
        }

        TEST(size should be 80.011 if input size is 80.011 in constructure)
        {
                Side side(80.011, 0, 100, true);
		ASSERT_EQ(0, side.getSize()-80.01);
        }

        TEST(size should be 80.015 if input size is 80.015 in constructure)
        {
                Side side(80.015, 0, 100, true);
		ASSERT_EQ(0, side.getSize()-80.01);
        }

	TEST(size should be invalid if size is equal to min size in constructure)
	{
                Side side(0, 0, 100, true);
		ASSERT_FALSE(side.isSizeValid());
	}

	TEST(size should be valid if size is equal to max size in constructure, max size is valid)
	{
                Side side(100, 0, 100, true);
		ASSERT_TRUE(side.isSizeValid());
	}

	TEST(size should be invalid if size is equal to max size in constructure, max size is invalid)
	{
                Side side(100, 0, 100, false);
		ASSERT_FALSE(side.isSizeValid());
	}

	TEST(size should be valid if size is between min and max size in constructure)
	{
                Side side(80, 0, 100, false);
		ASSERT_TRUE(side.isSizeValid());
	}

	TEST(size should be changed to 80.01 after setSize)
	{
		Side side(80.1, 0, 100, false);
		side.setSize(80.011);
		ASSERT_EQ(0, side.getSize()-80.01);
	}

};
